You can add another SwiftUI View that acts as a preview container to hold the state you need for the toggle.struct BindingViewExamplePreviewContainer_2 : View {
@State
private var value = false
var body: some View {
BindingViewExample_2(value: $value)
}
}
#if DEBUG
struct BindingViewExample_2_Previews : PreviewProvider {
static var previews: some View {
BindingViewExamplePreviewContainer_2()
}
}
#endif